import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: () => import('@/views/layout'),
    children: [
      { path: '', component: () => import('@/views/home') },
      { path: '/video', component: () => import('@/views/video') },
      { path: '/qa', component: () => import('@/views/qa') },
      { path: '/profile', component: () => import('@/views/profile') }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login')
  },
  { path: '/user', component: () => import('@/views/user') },
  { path: '/search', component: () => import('@/views/search') },
  // props为true表示开启props传参
  { path: '/article/:articleId', props: true, component: () => import('@/views/article') }

]

const router = new VueRouter({
  routes
})

export default router
